﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using First.Models;
using First.Filter;
using System.Web.Script.Serialization;
using System.Collections;
using First.unitl;

namespace First.Controllers
{
    public class IndexController : Controller
    {
        // GET: Index
        [MyAction(role ="user")]
        public ActionResult gettime()
        {
            string name = "测试";
            var time = DateTime.Now;
            var new_time = DateTime.Now.ToString("yyyy-MM-dd");
            var query = new { username = name, day = time,new_day=new_time };
            return Content( new JavaScriptSerializer().Serialize(query));
        }
        [MyAction(role = "user")]
        public ActionResult Index()
        {
            var s=new  music() { name = "ace", note = "测试"};
            var n = new music2() { name = "ace", note = "测试" };
            //var  s = new List<music>();
            //s.Add(new music() { name = "ace", note = "测试"});
            //s.Add(new music() { name = "ace1", note = "测试1" });
            //s.Add(new music() { name = "ace2", note = "测试2" });
            //var n = new List<music2>();
            //n.Add(new music2() { name = "ace", note = "测试" });
            //n.Add(new music2() { name = "ace1", note = "测试1" });
            //n.Add(new music2() { name = "ace2", note = "测试2" });
            return View(Tuple.Create(s,n));
        }
        public ActionResult newIndex()
        {
            var s = new List<music>();
            s.Add(new music() { name = "ace", note = "测试" });
            s.Add(new music() { name = "ace1", note = "测试1" });
            s.Add(new music() { name = "ace2", note = "测试2" });
            var n = new List<music2>();
            n.Add(new music2() { name = "face", note = "f测试" });
            n.Add(new music2() { name = "face1", note = "f测试1" });
            n.Add(new music2() { name = "face2", note = "f测试2" });
            musicModel m = new musicModel();
            m.m1 = s;
            m.m2 = n;
            return View(m);
        }
        public string jsonIndex()
        {
            

            List<items> list = new List<items>()
            {
                new items { day="01"},
                 new items { day="02"},
                  new items { day="03"}
            };
            return new JavaScriptSerializer().Serialize(list);
        }
        public ActionResult Login()
        {
            return View();
        }
        public ActionResult GetServiceResult()
        {
            string url = @"";
            string method = "get_report_detail";
            object[] param = new object[] {"151215061975"} ;
           object obj= ServiceHelp.InvokeWebService(url,method,param);
            //return Content(new JavaScriptSerializer().Serialize(obj));
            return Content(obj.ToString());
        }
    }
    public class items
    {
        public string day;
    }
}